﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Program10
{
    class Program
    {
        //运行时常量定义方法
        //static readonly是动态常量，常量的值在编译期间不解析
        //所以开始都是默认值，X与Y都是int类型，故都是0
        static readonly int B = A * 10;
        static readonly int A = 10;

        //编译时常量定义方法
        //const是静态常量，所以在编译的时候就将A与B的值确定下来了
        const int X = 10;
        const int Y = X * 10;

        static void Main(string[] args)
        {
            //变量
            var number = 10;
            number = 20;
            Console.WriteLine("输出变量的值：" + number);

            //常量
            const int number1 = 10;
            Console.WriteLine("输出常量的值：" + number1);
            //number1 = 20; //常量不能进行赋值

            Console.WriteLine("X: {0}  Y: {1}", X, Y);
            Console.WriteLine("A: {0}  B: {1}", A, B);

            Console.ReadLine();
        }
    }
}
